package no.ntnu.fp.model1;

import java.awt.Color;

public class Well {

	private LWS lws;
	private int wellId = 0;
	private Color CurrentColor = Color.green;
	private Color LastColor = Color.green;
	
	private void updateColor() {
		setCurrentColor(randomColor());
	}
	
	public Color getCurrentColor(){
		updateColor();
		return CurrentColor;
	}
	
	private Color getLastColor() {
		return LastColor;
	}
	
	public void setLastColor(Color currColor) {
		this.LastColor = currColor;
	}
	
	public void setCurrentColor(Color newColor) {
		setLastColor(CurrentColor);
		this.CurrentColor = newColor;
	}

	private Color randomColor(){
		int i = (int) Math.round(Math.random()*3);
		Color reColor;
		if(i == 0){
			reColor = Color.red;
		}else if(i==2||i==1){
			reColor = Color.green;
		}else{
			reColor = Color.yellow;
		}
		//countColors(reColor);
		return reColor;
	}
	
	public Well(LWS l, int wId) {
		setLws(l);
		setWellId(wId);
		setCurrentColor(Color.green);
	}

	public void setWellId(int wellId) {
		this.wellId = wellId;
	}

	public int getWellId() {
		return wellId;
	}

	public void setLws(LWS lws) {
		this.lws = lws;
	}

	public LWS getLws() {
		return lws;
	}



	
}
